package com.pubinfo.passbook.common.model.bo.witeoff;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.pubinfo.passbook.common.entity.TContractWriteoffRelation;
import com.pubinfo.passbook.common.model.bo.witeoff.subitem.ContractWriteoffItems;
import com.pubinfo.passbook.common.model.dto.open.WiteoffOpenPicking;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Data
@ApiModel(value = "ContractWiteoffBase", description = "报账单基础数据")
public class ContractWiteoffBase implements Serializable {
  public static final long serialVersionUID = 7424497997148290435L;
  @ApiModelProperty(value = "类型（10 成本冲销、20 冲成本冲销、30 结转、40 税金计提）")
  @NotNull(message = "类型不能为空")
  public Integer writeoffType;
  @ApiModelProperty(value = "外围系统主单唯一标志，每次报账都必须是唯一，不允许重复", hidden = true)
  public String otherSystemMainId;
  @ApiModelProperty(value = "报账人账号 集团统一用户目录账号（全国唯一）")
  public String account;
  @ApiModelProperty(value = "报账人姓名")
  public String fillInName;
  
  @ApiModelProperty(value = "报账组织编码 可以通过“获取报账组织信息”接口获取")
  public String fillInOrgCode;
  
  @ApiModelProperty(value = "公司代码  先做两种 (上市 ：A011", hidden = true)
  public String sapCompayCode = "A011";
  
  @ApiModelProperty(value = "经济事项编码   10040203  ", hidden = true)
  public String economicItemCode = "10040203";
  
  @ApiModelProperty(value = "经济事项名称   收到管线迁改赔偿", hidden = true)
  public String economicItemName = "收到管线迁改赔偿";
  
  @JsonIgnore
  @ApiModelProperty(value = "收支方式 8:不涉及收付", hidden = true)
  public String paymentType = "8";
  
  @ApiModelProperty(value = "费用发生日 取当前日期 格式为：YYYY-MM-DD", hidden = true)
  public String happenDate;
  
  @ApiModelProperty(value = "报账期间   格式必为：YYYY-MM  默认当前期间，每月1-4号默认上月期间", hidden = true)
  public String budgetSet;
  
  @ApiModelProperty(value = "业务类型 选项：0-列账(默认)，1-付款,2-列并付", hidden = true)
  public String bizType = "0";
  
  @ApiModelProperty(value = "会计科目编码 G933000009  ", hidden = true)
  public String accountCode = "G933000009";
  
  @ApiModelProperty(value = "会计科目名称 赔补类供应商", hidden = true)
  public String accountName = "赔补类供应商";
  
  @ApiModelProperty(value = "科目类型  选输(1-总账、2-供应商、3-客户)默认2", hidden = true)
  public String accountType = "2";
  
  @ApiModelProperty(value = "是否员工代垫 必须 如不涉及银行支付，请提供空值," +
      " 选项：0-否，1-是  <br/> " +
      " 为 (在职及供属医药费) 时 为 1 是  <br/> " +
      " 为   (退休员工医药费) (环保费)  (社会团体会费) 是为 0 否  默认空值", hidden = true)
  public String isStaffPayment;
  
  //@ApiModelProperty(value = "业务编码类型 非必须 选项 1-合同  3-采购订单号  5-框架汇总单号 如果为空，而且合同编码/业务编码字段又存在，则默认为1-合同")
  //public Byte bizCodeType;
  
  @ApiModelProperty(value = "活动预算编码 ", hidden = true)
  private String budgetProjectCode;
  
  @ApiModelProperty(value = "活动预算名称 带WBS编号，自动获取", hidden = true)
  private String budgetProjectName;
  
  @ApiModelProperty(value = "报账金额 必须 报账的总金额，一般是负数")
  public BigDecimal sum;
  //
  @ApiModelProperty(value = "说明 暂无固定文本 收到+合同编号+赔补费冲减成本+WBS项目编号 ", hidden = true)
  public String desc;
  
  @ApiModelProperty(value = "票据类型 非必须 当集成业务涉及增值税时，必须。 选项：" +
      "1-增值税专用发票，2-增值税普通发票，3-营业税发票，4-货物运输专用发票，" +
      "5-机动车销售统一发票，6-海关进口增值税专用缴款书，8-普通收据，9无发票，" +
      "10-国外发票（国外账单），11-代扣代缴税收通用缴款书，12-电子发票-普票，" +
      "13-增值税专用发票（免税高新企业），14-通行费电子发票，15-通用发票" +
      "目前这些选项中省系统只要提供“12-电子发票-普票”这一种票据类型，19-财政电子票据。9-无发票", hidden = true)
  public String invoiceType = "9";
  
  @ApiModelProperty(value = "是否调用预算  非必须  " +
      "0:不调用 1：调用(默认) 空：" +
      "通过经济事项+省级编码+外围系统标识到配置表进行查找 ", hidden = true)
  public Integer isBudget = 1;
  @ApiModelProperty(value = "业务场景（挑对模式）  非必须  业务场景（挑对模式）  \n " +
      "   * 1:冲前期借款（冲预付款） 2:挂账后付款（清偿应付款）   " +
      "3:冲预列（冲暂估） 7:挂账不付款（含预列） 8:预付款   9:挂账并付款(默认) 0:其他" +
      "冲减成本报账 默认3   冲减错误回冲报账 默认7", hidden = true)
  public String pickingMode = "7";
  @ApiModelProperty(value = "业务发生时间点标志  营改增业务必填  业务发生时间                                                点标志(1-[营改增日期]前，2-[营改增日期]后(默认))", hidden = true)
  public Integer businessHappenTimeFlag;
  
  @ApiModelProperty(value = "本位币种", hidden = true)
  private String currency = "CNY";
  @ApiModelProperty(value = "是否存在实物赠送  营改增业务必填 " +
      " 是否存在实物赠送 1：是0:否(默认) 实物  " +
      "赠送金额  DOUBLE  精确到2位小数点  实物赠送金额  营改增业务必填", hidden = true)
  public String isRealGift = "0";
  
  @ApiModelProperty(value = "备选统驭科目编码", hidden = true)
  private String preAccountCode = "2241070000";
  
  @ApiModelProperty(value = "备选统驭科目名称", hidden = true)
  private String preAccountNam = "其他应付款.暂收迁改补偿款 ";
  
  @ApiModelProperty(value = "是否付款\t非必须\t0-否，1-是，2-其他 非必须", hidden = true)
  private Integer isPayment = 0;
  @ApiModelProperty(value = "是否加急\t非必须\t0-否，1-是 非必须", hidden = true)
  private Integer isEmergency = 0;
  
  @ApiModelProperty(value = "是否涉及进项税转出\t非必须\t0-否，1-是 非必须", hidden = true)
  private Integer isInputTax = 0;
  @ApiModelProperty(value = "精确到2位小数点\t实物赠送金额\t营改增业务必填", hidden = true)
  private BigDecimal realGiftSum;
  
  @ApiModelProperty(value = "是否反记账\t可选\t1：是 非必须", hidden = true)
  private Integer isOppositeLedger = 1;
  
  @ApiModelProperty(value = "是否一单清 非必须\t1为一单清 0和空为非一单清", hidden = true)
  private Byte singleClearFlag = 1;
  @ApiModelProperty(value = "合同ID")
  public Integer contractId;
  @ApiModelProperty(value = "合同ID集合")
  public List<Integer> contractIds;
  
  @ApiModelProperty(value = "合同编码/业务编码")
  public String contractNo;
  
  @ApiModelProperty(value = "合同名称/业务名称")
  public String contractName;
  
  @ApiModelProperty(value = "是否需要手工扫描 必须 0-否(默认)，1-是", hidden = true)
  // @JsonFormat(shape = JsonFormat.Shape.NUMBER)
  public String isNeedImage = "0";
  
  @ApiModelProperty(value = "纳税属性  非必须  " +
      "1-属地纳税、2-汇总纳税(默认)、3-汇总传统，" +
      "根据经济事项配置的数据默认推导", hidden = true)
  public String payTaxAttribute = "2";
  
  @ApiModelProperty(value = "需要提供URL链接页面，即合同详情页面")
  private String showDataUrl;
  
  @JsonIgnore
  @ApiModelProperty(value = "是否需要手工扫描 必须 0-否(默认)，1-是", hidden = true)
  public Boolean isProcessShort = false; //是否为短流程

//  @JsonIgnore
//  @ApiModelProperty(value = "关联发票id集合，非必须", required = true)
//  public List<String> invoiceIds = new ArrayList<>();

//  @ApiModelProperty(hidden = true, value = "报账发票表,关联发票集合 非必须")
//  public List<TWiteoffInvoiceInfo> invoiceInfos = new ArrayList<>();
  
  @ApiModelProperty(value = "报账子单信息集合", required = true)
  public List<ContractWriteoffItems> lineItems = new ArrayList<>();
  
  @ApiModelProperty(value = "挑对记录 当业务场景是1、2、3时，要", hidden = true)
  public List<WiteoffOpenPicking> openItemPickings = new ArrayList<>();
//  @ApiModelProperty(value = "关联供应商集合 当“业务类型”为1，2时，且“是否员工代垫”为0时，必须")
//  public List<TWiteoffRelateSupplier> relateSuppliers = new ArrayList<>();
//
//  @ApiModelProperty(value = "收款方信息集合 当“业务类型”为1，2时，要")
//  public List<TWiteoffPayMent> payMentItems = new ArrayList<>();
//
//  @ApiModelProperty(value = "共享附件信息集合 当业务场景是1、2、3时，要(先空)")
//  public List<TWiteoffShareAttachment> shareAttachmentItems = new ArrayList<>();
//
//  @ApiModelProperty(value = "挑对记录 当业务场景是1、2、3时,要;(先空)")
//  public List<TWiteoffOpenPicking> openItemPickings = new ArrayList<>();
//
//  @ApiModelProperty(value = "报账审核资料集合,如需要查看业务数据，则必须(传参)")
//  public List<TWiteoffAttchment> attchmentAdds = new ArrayList<>();

//  @ApiModelProperty(value = "报账单关联收入及项目成本信息")
//  public List<TContractWriteoffRelation> witeoffs = new ArrayList<>();
  
  @ApiModelProperty(value = "挑对成本信息")
  public List<TContractWriteoffRelation> writeOffInfo = Collections.emptyList();
  
  @ApiModelProperty(value = "报账单关联WBS成本信息")
  public List<TContractWriteoffRelation> wbsInfo = Collections.emptyList();
//TContractProjectCostItems
  
  @JacksonXmlProperty(localName = "contractId")
  public Integer getContractId() {
    return contractId;
  }
  
  @JacksonXmlProperty(localName = "account")
  public String getAccount() {
    return account;
  }
  
  @JacksonXmlProperty(localName = "fillInName")
  public String getFillInName() {
    return fillInName;
  }
  
  @JacksonXmlProperty(localName = "fillInOrgCode")
  public String getFillInOrgCode() {
    return fillInOrgCode;
  }
  
  @JacksonXmlProperty(localName = "sapCompayCode")
  public String getSapCompayCode() {
    return sapCompayCode;
  }
  
  @JacksonXmlProperty(localName = "economicItemCode")
  public String getEconomicItemCode() {
    return economicItemCode;
  }
  
  @JacksonXmlProperty(localName = "economicItemName")
  public String getEconomicItemName() {
    return economicItemName;
  }
  
  @JacksonXmlProperty(localName = "paymentType")
  public String getPaymentType() {
    return paymentType;
  }
  
  @JacksonXmlProperty(localName = "happenDate")
  public String getHappenDate() {
    return happenDate;
  }
  
  @JacksonXmlProperty(localName = "budgetSet")
  public String getBudgetSet() {
    return budgetSet;
  }
  
  @JacksonXmlProperty(localName = "bizType")
  public String getBizType() {
    return bizType;
  }
  
  @JacksonXmlProperty(localName = "accountCode")
  public String getAccountCode() {
    return accountCode;
  }
  
  @JacksonXmlProperty(localName = "accountName")
  public String getAccountName() {
    return accountName;
  }
  
  @JacksonXmlProperty(localName = "accountType")
  public String getAccountType() {
    return accountType;
  }
  
  @JacksonXmlProperty(localName = "isStaffPayment")
  public String getIsStaffPayment() {
    return isStaffPayment;
  }
  
  @JacksonXmlProperty(localName = "contractNo")
  public String getContractNo() {
    return contractNo;
  }
  
  @JacksonXmlProperty(localName = "contractName")
  public String getContractName() {
    return contractName;
  }
  
  @JacksonXmlProperty(localName = "sum")
  public BigDecimal getSum() {
    return sum;
  }
  
  @JacksonXmlProperty(localName = "isNeedImage")
  public String getNeedImage() {
    return isNeedImage;
  }
  
  @JacksonXmlProperty(localName = "isRealGift")
  public String getIsRealGift() {
    return isRealGift;
  }
  
  @JacksonXmlProperty(localName = "payTaxAttribute")
  public String getPayTaxAttribute() {
    return payTaxAttribute;
  }
  
  @JacksonXmlProperty(localName = "pickingMode")
  public String getPickingMode() {
    return pickingMode;
  }
  
  @JacksonXmlProperty(localName = "isEmergency")
  public Integer getIsEmergency() {
    return isEmergency;
  }
  
  @JacksonXmlElementWrapper(localName = "lineItems")
  @JacksonXmlProperty(localName = "lineItem")
  public List<ContractWriteoffItems> getLineItems() {
    return lineItems;
  }
  
  @JacksonXmlElementWrapper(localName = "openItemPickings")
  @JacksonXmlProperty(localName = "openItemPicking")
  public List<WiteoffOpenPicking> getOpenItemPickings() {
    return openItemPickings;
  }
  
}
